﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace WTwitter.Model.Twitter.Json {
	/// <summary>
	/// TwitterのJson形式データ
	/// </summary>
	[DataContract]
	public class Status : IEquatable<Status> {
		[DataMember(Name = "id")]
		public long Id { get; set; }

		[DataMember(Name = "text")]
		public string Text { get;set;}

		[DataMember(Name = "favorited")]
		public bool Favorited { get; set; }

		[DataMember(Name="user")]
		public User User { get; set; }

		[DataMember(Name = "in_reply_to_user_id")]
		public long? InReplyToUserId { get; set; }

		[DataMember(Name = "in_reply_to_status_id")]
		public long? InReplyToStatusId { get; set; }

		[DataMember(Name = "in_reply_to_screen_name")]
		public string InReplyToScreenName { get; set; }

		[DataMember(Name = "created_at")]
		public string CreatedAtString { get; set; }

		[DataMember(Name = "source")]
		public string Source { get; set; }

		[DataMember(Name = "truncated")]
		public bool Truncated { get; set; }

		public override string ToString() {
			return User.ScreenName + ":" + Text;
		}

		#region IEquatable<Status> メンバ

		public bool Equals(Status other) {
			if (other == null) {
				return false;
			}

			return this.Id == other.Id;
		}

		#endregion

		public override int GetHashCode() {
			return this.Id.GetHashCode();
		}
	}
}
